<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>任务发布</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="SHORTCUT ICON" href="${ctx}/img/favicon.ico"/>
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="stylesheet" href="${ctx}/assets/css/amazeui.min.css"/>
    <link rel="stylesheet" href="${ctx}/assets/css/admin.css">
    <link rel="stylesheet" href="${ctx}/assets/css/app.css">

</head>
<body>
<jsp:include page="header.jsp"/>
<div class="tpl-page-container tpl-page-header-fixed">
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <div class="tpl-left-nav tpl-left-nav-hover">
        <div class="tpl-left-nav-title">
            操作列表
        </div>
        <div class="tpl-left-nav-list">
            <ul class="tpl-left-nav-menu">
                <li class="tpl-left-nav-item">
                    <a href="#" class="nav-link  ">
                        <i class="am-icon-home"></i>
                        <span>首页</span>
                    </a>
                </li>

                <li class="tpl-left-nav-item">
                    <a href="javascript:;" class="nav-link tpl-left-nav-link-list active">
                        <i class="am-icon-table"></i>
                        <span>任务管理</span>
                        <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr tpl-left-nav-more-ico-rotate"></i>
                    </a>
                    <ul class="tpl-left-nav-sub-menu"  style="display: block;">
                        <li>
                            <a href="${ctx}/receive/all" <c:if  test="${status == 'all'}"> class='active'</c:if>  >
                                <i class="am-icon-angle-right"></i>
                                <span>任务市场</span>    <i class="am-icon-star tpl-left-nav-content-ico am-fr am-margin-right"></i>

                            </a>
                            <a href="${ctx}/receive/finish"  <c:if test="${status == 'finish'}"> class='active' </c:if>>
                                <i class="am-icon-angle-right"></i>
                                <span>已接任务</span>
                            </a>
                        </li>
                    </ul>
                </li>

            </ul>
        </div>
    </div>

    <div class="tpl-content-wrapper">
        <div class="tpl-content-page-title">
            任务发布
        </div>
        <ol class="am-breadcrumb">
            <li><a href="${ctx}/index.html" class="am-icon-home">首页</a></li>
            <li><a href="${ctx}/message.html">任务管理</a></li>
        </ol>
        <div class="tpl-portlet-components">
            <div class="portlet-title">
                <div class="caption font-green bold">

                </div>
                <div class="tpl-portlet-input tpl-fz-ml">
                    <div class="portlet-input input-small input-inline">
                        <div class="input-icon right">
                            <i class="am-icon-search"></i>
                            <input type="text" class="form-control form-control-solid" placeholder="搜索..."></div>
                    </div>
                </div>


            </div>

            <div class="tpl-block">

                <div class="am-g">
                    <div class="tpl-form-body tpl-form-line">
                        <div class="am-form tpl-form-line-form">
                            <div class="am-form-group">
                                <label  class="am-u-sm-3 am-form-label">任务标题 <span
                                        class="tpl-form-line-small-title">Title</span></label>
                                <div class="am-u-sm-9">
                                    <span>${info.title}</span>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label  class="am-u-sm-3 am-form-label">任务内容<span
                                        class="tpl-form-line-small-title">content</span></label>
                                <div class="am-u-sm-9">
                                    <span>${info.content}</span>
                                </div>
                            </div>
                            <c:if test="${info.handleContent==null}">

                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label">回答内容
                                        <span>Content</span></label>
                                    <div class="am-u-sm-9">
                                        <div id="editor">
                                        </div>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <div class="am-u-sm-9 am-u-sm-push-3">
                                        <button type="button" class="am-btn am-btn-primary tpl-btn-bg-color-success"
                                                id="submitbtn">提交
                                        </button>
                                    </div>
                                </div>
                            </c:if>
                            <c:if test="${info.handleContent!=null}">
                                <div class="am-form-group">
                                    <label  class="am-u-sm-3 am-form-label">回答内容<span
                                            class="tpl-form-line-small-title">content</span></label>
                                    <div class="am-u-sm-9">
                                        <span>${info.handleContent}</span>
                                    </div>
                                </div>
                            </c:if>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<div class="am-modal am-modal-alert" tabindex="-1" id="my-alertsuccess">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">处理请求中</div>
        <div class="am-modal-bd">
            处理成功！
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn">确定</span>
        </div>
    </div>
</div>
<script src="${ctx}/assets/js/jquery.min.js"></script>
<script src="${ctx}/assets/js/amazeui.min.js"></script>
<script src="${ctx}/assets/js/echarts.min.js"></script>
<script src="${ctx}/assets/js/iscroll.js"></script>
<script src="${ctx}/assets/js/app.js"></script>
<script src="${ctx}/assets/js/wangEditor.min.js"></script>

<script>
    var E = window.wangEditor;
    var editor = new E('#editor');
    // 或者 var editor = new E( document.getElementById('#editor') )
    editor.customConfig.uploadImgShowBase64 = true;
    editor.create();
    var progress = $.AMUI.progress;
    $(function () {
        progress.start();
    });
    window.onload = function () {
        progress.done();
    }
    $("#submitbtn").click(function () {
        debugger
        var content = editor.txt.html();
        debugger
        $.ajax({
            url: ${ctx}'/receive/save',
            type: 'GET',
            data: {
                'taskId':'${info.taskId}',
                'content': content,
            },
            cache: false,
            async: false,
            dataType: 'JSON',
            success: function (result) {
                if(result.data==100){
                   location.href="/receive/all" ;
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert('失败' + textStatus + XMLHttpRequest.status + errorThrown)
            }
        });
    });
</script>
</body>
</html>